//
//  CycleImageTableViewCell.m
//  10-易车
//
//  Created by dllo on 16/7/27.
//  Copyright © 2016年 LST. All rights reserved.
//

#import "CycleImageTableViewCell.h"

@implementation CycleImageTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatSubView];
    }
    return self;
    
}

- (void)creatSubView{
    self.btnFirst = [UIButton buttonWithType:UIButtonTypeCustom];
    self.btnFirst.backgroundColor = [UIColor colorWithRed:241 / 255.0 green:241 / 255.0 blue:241 / 255.0 alpha:1];
    self.btnFirst.frame = CGRectMake(0, 0, self.frame.size.width / 4, self.frame.size.height);
    [self.btnFirst setTitle:@"贷款买车" forState:UIControlStateNormal];
    self.btnFirst.titleLabel.font = [UIFont systemFontOfSize:16 weight:0.1];
    self.btnFirst.titleLabel.textAlignment = NSTextAlignmentCenter;
    [self.btnFirst setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [self.btnFirst setTitle:@"贷款买车" forState:UIControlStateHighlighted];
    [self.btnFirst setImage:[UIImage imageNamed:@"1"] forState:UIControlStateNormal];
    self.btnFirst.imageEdgeInsets = UIEdgeInsetsMake(10, 20, 20, 20);
    self.btnFirst.titleEdgeInsets = UIEdgeInsetsMake(60, -self.btnFirst.bounds.size.width - 30, 0, 0);
    [self.contentView addSubview:self.btnFirst];
    
    self.btnSecond = [UIButton buttonWithType:UIButtonTypeCustom];
    self.btnSecond.backgroundColor = [UIColor colorWithRed:241 / 255.0 green:241 / 255.0 blue:241 / 255.0 alpha:1];
    self.btnSecond.frame = CGRectMake(self.frame.size.width / 4, 0, self.frame.size.width / 4, self.frame.size.height);
    [self.btnSecond setTitle:@"直销车型" forState:UIControlStateNormal];
    self.btnSecond.titleLabel.font = [UIFont systemFontOfSize:16 weight:0.1];
    [self.btnSecond setTitle:@"直销车型" forState:UIControlStateHighlighted];
    [self.btnSecond setImage:[UIImage imageNamed:@"2"] forState:UIControlStateNormal];
    [self.btnSecond setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    self.btnSecond.imageEdgeInsets = UIEdgeInsetsMake(10, 20, 20, 20);
    self.btnSecond.titleEdgeInsets = UIEdgeInsetsMake(60, -self.btnSecond.bounds.size.width - 30, 0, 0);
    [self.contentView addSubview:self.btnSecond];
    
    self.btnThird = [UIButton buttonWithType:UIButtonTypeCustom];
    self.btnThird.backgroundColor = [UIColor colorWithRed:241 / 255.0 green:241 / 255.0 blue:241 / 255.0 alpha:1];
    self.btnThird.frame = CGRectMake(self.frame.size.width / 2, 0, self.frame.size.width / 4, self.frame.size.height);
    [self.btnThird setTitle:@"底价买车" forState:UIControlStateNormal];
    self.btnThird.titleLabel.font = [UIFont systemFontOfSize:16 weight:0.1];
    [self.btnThird setTitle:@"底价买车" forState:UIControlStateHighlighted];
    [self.btnThird setImage:[UIImage imageNamed:@"3"] forState:UIControlStateNormal];
    [self.btnThird setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    self.btnThird.imageEdgeInsets = UIEdgeInsetsMake(10, 20, 20, 20);
    self.btnThird.titleEdgeInsets = UIEdgeInsetsMake(60, -self.btnThird.bounds.size.width - 30, 0, 0);
    [self.contentView addSubview:self.btnThird];
    
    self.btnFourth = [UIButton buttonWithType:UIButtonTypeCustom];
    self.btnFourth.backgroundColor = [UIColor colorWithRed:241 / 255.0 green:241 / 255.0 blue:241 / 255.0 alpha:1];
    self.btnFourth.frame = CGRectMake(self.frame.size.width / 4 * 3, 0, self.frame.size.width / 4, self.frame.size.height);
    [self.btnFourth setTitle:@"二手车" forState:UIControlStateNormal];
    self.btnFourth.titleLabel.font = [UIFont systemFontOfSize:16 weight:0.1];
    [self.btnFourth setTitle:@"二手车" forState:UIControlStateHighlighted];
    [self.btnFourth setImage:[UIImage imageNamed:@"4"] forState:UIControlStateNormal];
    [self.btnFourth setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    self.btnFourth.imageEdgeInsets = UIEdgeInsetsMake(10, 20, 20, 20);
    self.btnFourth.titleEdgeInsets = UIEdgeInsetsMake(60, -self.btnFourth.bounds.size.width - 30, 0, 0);
    [self.contentView addSubview:self.btnFourth];
    
}

- (void)layoutSubviews{
    [super layoutSubviews];
    self.btnFirst.frame = CGRectMake(0, 0, self.frame.size.width / 4, self.frame.size.height);
    self.btnSecond.frame = CGRectMake(self.frame.size.width / 4, 0, self.frame.size.width / 4, self.frame.size.height);
    self.btnThird.frame = CGRectMake(self.frame.size.width / 2, 0, self.frame.size.width / 4, self.frame.size.height);
    self.btnFourth.frame = CGRectMake(self.frame.size.width / 4 * 3, 0, self.frame.size.width / 4, self.frame.size.height);
    
}
@end
